import java.lang.reflect.Array;
import java.util.Arrays;

public class CreatSZ {
    //数组部分拷贝
    public static void main3(String[] args) {
    int[] array = {1, 2, 3, 4, 5};
    int[] copy = Arrays.copyOfRange(array, 1, 3);
        System.out.println(Arrays.toString(copy));
}
    public static void main2(String[] args) {
        //数组扩容
        int[] array ={1,2,3,4};
        array = Arrays.copyOf(array,array.length*2);
        System.out.println(Arrays.toString(array));
    }
    public static void main1(String[] args) {
        //数组全部拷贝
        int[] array = {1,2,3,4};
         int[] copy = Arrays.copyOf(array,array.length);
        for (int i = 0; i < array.length; i++) {
            copy[i] = array[i];
        }
        System.out.println(Arrays.toString(array ));
    }
}



